$(function () {
    findDraftDailyByName(localStorage.getItem("username"));
})

function findDraftDailyByName(username) {
    let data=myAjax("/daily/findDraftDailyByName",{userName:username},"post");
    data=data.data;
    console.log(data)
    $("#dailyType").val(data.dailyType);
    $("#major").val(data.major);
    $("#coach").val(data.coach);
    $("#supervision").val(data.supervision);
    $("#learningContent").val(data.learningContent);
    $("#harvest").val(data.harvest);
    $("#insufficient").val(data.insufficient);
    $("#opinion").val(data.opinion);
}

function dailyUpdate(state) {
    let da={
        dailyType:$("#dailyType").val(),
        userName:localStorage.getItem("username"),
        major:$("#major").val(),
        coach:$("#coach").val(),
        supervision:$("#supervision").val(),
        learningContent:$("#learningContent").val(),
        harvest:$("#harvest").val(),
        insufficient:$("#insufficient").val(),
        opinion:$("#opinion").val(),
        state:state,
    }
    let data=myAjax("/daily/dailyUpdate",da,"post");
    data=data.code;
    if (data==200){
        alert("提交成功");
        $('#middle-reght').load('daily/myDailyFind.html');
    }else if (data==500){
        alert("提交失败");
    }
}